﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Net.Fan.SmallPig.Common.DrawOperate
{
    public class OperateItem : BaseItem
    {
        public static Color OperateFrontColor = Color.White;
       public static Color OperateBackColor = Color.BlueViolet;

        StateItem nextState;
        string[] operators;


        public string[] Operators
        {
            get { return operators; }
            set { operators = value; }
        }

        public StateItem NextState
        {
            get { return nextState; }
            set { nextState = value; }
        }

        //public string Operate
        //{
        //    get { return operate; }
        //    set { operate = value; }
        //}

        public bool HavePermission(string username)
        {
            return true;
        }

        public Point[] GetOperateToNextStateArrow()
        {
            Point[] points = new Point[2];
            points[0] = this.Rectangle.RightCenter();
            points[1] = this.nextState.Rectangle.LeftCenter();
            return points;
        }

        /// <summary>
        /// 这是折线形式
        /// </summary>
        /// <param name="currentItem"></param>
        /// <returns></returns>
        public Point[] GetCurrentStateToOperateArrow(StateItem currentItem)
        {
            Point[] points = new Point[4]; 
            points[0] = currentItem.Rectangle.RightCenter();//x1,y1
          
            points[3] = this.Rectangle.LeftCenter();//x2,y2
            int x3 = (points[0].X + points[3].X) / 2;
            points[1] = new Point(x3,points[0].Y);//(x1,x2)/2,y1
            points[2] = new Point(x3, points[3].Y); //(x1,x2)/2,y1
            return points;
        }
    }
}
